﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.OleDb;
using System.Data;

/// <summary>
/// Summary description for proekt25
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class proekt25 : System.Web.Services.WebService {

    public proekt25 () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
    int taksa;
    [WebMethod]
    public int presmetka (string ime_igrac) {

        int k = 0;
        int h = 0;

        string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Proekt.mdb;"; //postavuvame "adresa" do bazata
        OleDbConnection conn = new OleDbConnection(conString);
        conn.Open();

        string sel = "Select IME from IGRACI where IME=@IME ";
        OleDbCommand cmdSelect = new OleDbCommand(sel, conn);
        cmdSelect.Parameters.AddWithValue("@IME", ime_igrac);

        RegistarNaImoti a = new RegistarNaImoti();

        string[] polinja;
        polinja = a.proveriImot(ime_igrac);
        int br = polinja.Length;
        for (int i = 0; i < br; i++)
        {
            k = k + a.proveriKuki(polinja[i]);
            h = h + a.proveriHoteli(polinja[i]);
        }

        taksa = (k * (1500 / 100 * 10)) + (h * (1200 / 100 * 10)) + (100 / 100 * 10);
        
        return taksa;
    
    }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
    
}
